using System;

namespace Mbs.Modularity
{
    public interface IModuleListner : IListner<ModuleListnerType>
    {
        void OnInstalled(ModuleEventArgs e);
        void OnStarted(ModuleEventArgs e);
        void OnStopped(ModuleEventArgs e);
        void OnUninstalled(ModuleEventArgs e);
        void OnStarting(ModuleEventArgs e);
        void OnStopping(ModuleEventArgs e);

        void OnExcption(ModuleEventArgs e);
    }

    [Flags]
    public enum ModuleListnerType
    {
        Undefine = 1,
        Installed = 2,
        Starting = 4,
        Started = 8,
        Stopping = 16,
        Stopped = 32,
        Uninstalled = 64,
        Exception = 128,

        All = Installed | Starting | Started | Stopping | Stopped | Uninstalled,
    }

    public class ModuleListnerAdpater : Listner<ModuleListnerType>, IModuleListner
    {
        public ModuleListnerAdpater(ModuleListnerType type) : base(type) { }
        public virtual void OnInstalled(ModuleEventArgs e) { }
        public virtual void OnStarted(ModuleEventArgs e) { }
        public virtual void OnStopped(ModuleEventArgs e) { }
        public virtual void OnUninstalled(ModuleEventArgs e) { }
        public virtual void OnStarting(ModuleEventArgs e) { }
        public virtual void OnStopping(ModuleEventArgs e) { }

        public virtual void OnExcption(ModuleEventArgs e) { }
    }
}
